% Create a figure to work with
fig = figure('NumberTitle','off','Name','Sudoku grace a la méthode du recuit simulé');

% Create the axes
ax = axes('Units','normal','Position',[.1 .1 .8 .8]);
axis off % Make the axes invisible
axis ij % Origin at top left

% Define the default values for text
set(fig,'DefaultTextFontName','courier', ... % So text lines up
'DefaultTextHorizontalAlignment','left', ...
'DefaultTextVerticalAlignment','bottom', ...
'DefaultTextClipping','on')

% Define the matrix
A = Prog;

% Determine the number of rows and columns
[m,n] = size(A);

% Draw the first column
axis([1 m 1 n])
drawnow
tmp = text(0.9,.5,'t');
ext = get(tmp,'Extent');
dy = ext(1); % Height of a single character.
wch = ext(3); % Width of a single character.
fw = 8; % Column width. Each column can have up to
% 8-digits in it.
plo = 8*dy;
dplo = 2*dy;
ploy = plo + dplo;
wc = 8*wch; % Width of 8 digit column
dwc = 2*wch; % Distance between columns
dx = wc+dwc; % Step used for columns
x = 1; % Location of first column
delete(tmp)
for i = 1:n % Column
	y = 1;
	for j = 1:m % Row
		y = y + abs(dy); % Location of row
		t(j,i) = text(x,y,sprintf('%3.1d',A(j,i)));
	end
	x = x+dx; % Location of next column
end

% Fix up the axes
axis([1-dwc/2 1+9*dx-dwc/2 1 n])
set(gca,'XTick',(1-dwc/2):3*dx:x)
set(gca,'XGrid','on','GridLineStyle','-','Box','on')
set(gca,'YTick',1.1+3*dy:3*dy:y)
set(gca,'YGrid','on','GridLineStyle','-','Box','on')
set(gca,'YTickLabel',[],'XTickLabel',[],'Visible','on')
